
const btn = document.getElementById('btn')
btn.onclick = function () {
    const url = "http://47.105.173.95:3000/api/users?id=1"
    //#1.创建xhr实例
    const xhr = new XMLHttpRequest()
    //#2.初始化一个请求
    xhr.open('GET', url)
    //#3.发送请求
    xhr.send()
    //#4.监听xhr的readystate的变化，使用onreadystatechange函数
    xhr.onreadystatechange = function (e) {
        if (xhr.readyState == 4) {
            console.log('响应已经完成')
            console.log(xhr.responseText)
            console.log(typeof this.responseText)
            let resObj = JSON.parse(xhr.responseText)
            console.log(resObj)
        }
    }
    console.log('看看谁先')

}